package com.liuxing.doctor.config;

import com.liuxing.doctor.intercept.LoginIntercepter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @athuer 行柳
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //创建拦截器对象
        HandlerInterceptor interceptor=new LoginIntercepter();
        String url[]={"/**"};
        String exclude_url[]={"/login","/index","/static/**"};
        registry.addInterceptor(interceptor).addPathPatterns(url).excludePathPatterns(exclude_url);

    }
}
